/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package VO;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Julian
 */
@Entity
@Table(name = "visto")
@NamedQueries({
    @NamedQuery(name = "Visto.findAll", query = "SELECT v FROM Visto v"),
    @NamedQuery(name = "Visto.findByIdEmpresa", query = "SELECT v FROM Visto v WHERE v.idEmpresa = :idEmpresa"),
    @NamedQuery(name = "Visto.findByClickT", query = "SELECT v FROM Visto v WHERE v.clickT = :clickT"),
    @NamedQuery(name = "Visto.findByNumeroVotos", query = "SELECT v FROM Visto v WHERE v.numeroVotos = :numeroVotos"),
    @NamedQuery(name = "Visto.findByTotal", query = "SELECT v FROM Visto v WHERE v.total = :total")})
public class Visto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idEmpresa")
    private String idEmpresa;
    @Basic(optional = false)
    @Column(name = "clickT")
    private int clickT;
    @Basic(optional = false)
    @Column(name = "numeroVotos")
    private int numeroVotos;
    @Basic(optional = false)
    @Column(name = "total")
    private int total;
    @JoinColumn(name = "idEmpresa", referencedColumnName = "idEmpresas", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Empresas empresas;

    public Visto() {
    }

    public Visto(String idEmpresa) {
        this.idEmpresa = idEmpresa;
    }

    public Visto(String idEmpresa, int clickT, int numeroVotos, int total) {
        this.idEmpresa = idEmpresa;
        this.clickT = clickT;
        this.numeroVotos = numeroVotos;
        this.total = total;
    }

    public String getIdEmpresa() {
        return idEmpresa;
    }

    public void setIdEmpresa(String idEmpresa) {
        this.idEmpresa = idEmpresa;
    }

    public int getClickT() {
        return clickT;
    }

    public void setClickT(int clickT) {
        this.clickT = clickT;
    }

    public int getNumeroVotos() {
        return numeroVotos;
    }

    public void setNumeroVotos(int numeroVotos) {
        this.numeroVotos = numeroVotos;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public Empresas getEmpresas() {
        return empresas;
    }

    public void setEmpresas(Empresas empresas) {
        this.empresas = empresas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEmpresa != null ? idEmpresa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Visto)) {
            return false;
        }
        Visto other = (Visto) object;
        if ((this.idEmpresa == null && other.idEmpresa != null) || (this.idEmpresa != null && !this.idEmpresa.equals(other.idEmpresa))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "VO.Visto[idEmpresa=" + idEmpresa + "]";
    }

}
